Fix that optional error return for EditFilter hook.
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 7 May 2006 07:26:25 +0000 (07:26 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 7 May 2006 07:26:25 +0000 (07:26 +0000)
Didn't work at all previously, with two entire ways to prevent the value being passed along. :)

docs/hooks.txt
includes/EditPage.php

index 3c46368..2f3d8c8 100644 (file)
@@ -300,8 +300,8 @@ $user: the user who did the block (not the one being blocked)
 'EditFilter': Perform checks on an edit
 $editor: Edit form (see includes/EditPage.php)
 $text: Contents of the edit box
-&section: Section being edited
-$error: Error message to return
+$section: Section being edited
+&$error: Error message to return
 
 Return false to halt editing; you'll need to handle error messages, etc. yourself.
 Alternatively, modifying $error and returning true will cause the contents of $error
index a708dd4..abb5e16 100644 (file)
@@ -493,7 +493,7 @@ class EditPage {
                        wfProfileOut( "$fname-checks" );
                        return false;
                }
-               if ( !wfRunHooks( 'EditFilter', array( &$this, $this->textbox1, $this->section, $this->hookError ) ) ) {
+               if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError ) ) ) {
                        # Error messages etc. could be handled within the hook...
                        wfProfileOut( $fname );
                        wfProfileOut( "$fname-checks" );
@@ -778,7 +778,7 @@ class EditPage {
                                $wgOut->addWikiText( wfMsg( 'missingsummary' ) );
                        }
                        
-                       if( !$this->hookError = '' ) {
+                       if( !$this->hookError == '' ) {
                                $wgOut->addWikiText( $this->hookError );
                        }